{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import pandas as pd\n",
    "#对series进行排序\n",
    "s1 = pd.Series(np.random.randn(10))\n",
    "s1\n",
    "s1.values\n",
    "s1.index\n",
    "s1.sort_values() #从小到大排序\n",
    "s1.sort_index()\n",
    "df1 = pd.DataFrame(np.random.randn(40).reshape(8,5))\n",
    "# df1 = pd.read_csv('年度数据.csv',index_col=0,encoding='gb2312')\n",
    "# df1.sort_values() #默认为快速排序\n",
    "# df1['2021年'].sort_values(ascending=False)\n",
    "# df1.sort_values('2021年')\n",
    "# df1.sort_index(ascending=False)\n",
    "# 改变index\n",
    "# df1.index = pd.Series(['1','2','3'])\n",
    "# df1.index.map(str.upper) #传入function\n",
    "# df1.rename(index=str.lower,columns = str.upper) #也可以传入字典{需要改的:你改的值}\n",
    "#Data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 1
}
